home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Sample Code / PartMaker 4.3 / TRootObj.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-03-12  |  2.9 KB  |  123 lines  |  [TEXT/MPS ]

  1. /*
  2. ** Apple Macintosh Developer Technical Support
  3. **
  4. ** File:        TRootObj.c
  5. ** Written by:    Eric Soldan
  6. **
  7. ** Copyright © 1992 Apple Computer, Inc.
  8. ** All rights reserved.
  9. */
  10.  
  11. /* You may incorporate this sample code into your applications without
  12. ** restriction, though the sample code has been provided "AS IS" and the
  13. ** responsibility for its operation is 100% yours.  However, what you are
  14. ** not permitted to do is to redistribute the source as "DSC Sample Code"
  15. ** after having made changes. If you're going to re-distribute the source,
  16. ** we require that you make it clear in the source that the code was
  17. ** descended from Apple Sample Code, but that you've made changes. */
  18.  
  19. /* See the files "=How to write your app" and "=Using TreeObj.c" for information
  20. ** on this function. */
  21.  
  22. /* This file isn't really used for much here.  The whole hierarchical document usage of
  23. ** AppWannabe is very limited.  This file is here so that AppWannabe can be converted
  24. ** into an application that does use the hierarchical document architecture.  AppWannabe
  25. ** is all set up to start using it.  This is convenient, as it allows there to be an
  26. ** initial document type. */
  27.  
  28.  
  29.  
  30. /*****************************************************************************/
  31.  
  32.  
  33.  
  34. #include "App.h"            /* Get the application includes/typedefs, etc.    */
  35. #include "App.protos.h"        /* Get the prototypes for application.            */
  36.  
  37. #ifndef __OSEVENTS__
  38. #include <OSEvents.h>
  39. #endif
  40.  
  41. #ifndef __OSUTILS__
  42. #include <OSUtils.h>
  43. #endif
  44.  
  45. #ifndef __QUICKDRAW__
  46. #include <Quickdraw.h>
  47. #endif
  48.  
  49. #ifndef __UTILITIES__
  50. #include "Utilities.h"
  51. #endif
  52.  
  53.  
  54.  
  55. /*****************************************************************************/
  56.  
  57.  
  58.  
  59. static RootObjPeek    *gMWERKSDebug;
  60.     /* For Metroweks debugging of AppsToGo "objects", you need an instance of the
  61.     ** same type you wish to view it in the debugger.  Now we have an instance. */
  62.  
  63.  
  64.  
  65. /*****************************************************************************/
  66. /*****************************************************************************/
  67.  
  68. #ifdef applec
  69. #pragma segment TRootObj
  70. #endif
  71.  
  72. /*****************************************************************************/
  73. /*****************************************************************************/
  74.  
  75.  
  76.  
  77. long    TRootObj(TreeObjHndl hndl, short message, long data)
  78. {
  79.     short    fileRefNum;
  80. #if VH_VERSION
  81.     char    *cptr;
  82. #endif
  83.  
  84.     switch (message) {
  85.         case FREADMESSAGE:
  86.             fileRefNum = data;
  87.             return(ReadTreeObjData(hndl, fileRefNum));
  88.             break;
  89.  
  90.         case FWRITEMESSAGE:
  91.             fileRefNum = data;
  92.             return(WriteTreeObjData(hndl, fileRefNum));
  93.             break;
  94.  
  95.         case HREADMESSAGE:
  96.             return(HReadTreeObjData(hndl, (Handle)data));
  97.             break;
  98.  
  99.         case HWRITEMESSAGE:
  100.             return(HWriteTreeObjData(hndl, (Handle)data));
  101.             break;
  102.  
  103.         case VHMESSAGE:
  104. #if VH_VERSION
  105.             cptr = ((VHFormatDataPtr)data)->data;
  106.             ccatchr(cptr, 13, 2);
  107.             VHRootInfo(hndl, cptr);
  108.             ccatchr(cptr, 13, 2);
  109.             VHFileRecInfo(hndl, cptr);
  110.             return(true);
  111. #endif
  112.             break;
  113.  
  114.         default:
  115.             break;
  116.     }
  117.  
  118.     return(noErr);
  119. }
  120.  
  121.  
  122.  
  123.